package com.hmdp.mapper;

import com.hmdp.entity.BlogComments;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface BlogCommentsMapper extends BaseMapper<BlogComments> {

    @Select("SELECT\n" +
            "            bl.*,\n" +
            "            u.icon,\n" +
            "            u.nick_name\n" +
            "        FROM `tb_blog_comments` bl\n" +
            "        left join tb_user u\n" +
            "        on u.id = bl.user_id\n" +
            "        where bl.blog_id = #{blogId}\n" +
            "        order by bl.id desc")
    List<BlogComments> getComments(Long blogId);
}
